package io.demo.qsprotobuf;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import reactor.core.publisher.Mono;

@RestController
public class CourseController {
    private CourseRepository courseRepo;

    public CourseController(@Autowired CourseRepository courseRepo) {
        this.courseRepo = courseRepo;
    }

    @GetMapping("/courses/{id}")
    public Mono<Course> customer(@PathVariable Integer id) {
        return Mono.just(courseRepo.findOne(id));
    }
}
